<?php

namespace App\Mail;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;

class ValidateCodeEmail extends Mailable
{
    use Queueable, SerializesModels;

    public $email_content;

    /**
     * Create a new message instance.
     */
    public function __construct($email_content)
    {
        $this->email_content = $email_content;
    }

    public function build()
    {
        return $this->subject($this->email_content['title'])
            ->view($this->email_content['view'])
            ->with([
                'body' => $this->email_content['body'],
                'user' => $this->email_content['user'],
                'code' =>  $this->email_content['code'],
                'name' =>  $this->email_content['name'],
            ]);

        // $this->view('emails.demo')
        //     ->subject('Demo Email Subject')
        //     ->from('sender@example.com', 'Sender Name')
        //     ->to('recipient@example.com', 'Recipient Name')
        //     ->cc('cc@example.com', 'CC Name')
        //     ->bcc('bcc@example.com', 'BCC Name')
        //     ->replyTo('reply-to@example.com', 'Reply To Name')
        //     ->with([
        //         'data' => $this->data,
        //     ]);
    }

    /**
     * Get the message envelope.
     */
    // public function envelope(): Envelope
    // {
    //     return new Envelope(
    //         subject: 'Validate Code Email',
    //     );
    // }

    // /**
    //  * Get the message content definition.
    //  */
    // public function content(): Content
    // {
    //     return new Content(
    //         view: 'view.name',
    //     );
    // }

    // /**
    //  * Get the attachments for the message.
    //  *
    //  * @return array<int, \Illuminate\Mail\Mailables\Attachment>
    //  */
    // public function attachments(): array
    // {
    //     return [];
    // }
}
